package com.gof.example.state;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/13 16:10.
 * haiming.fei@tongdun.cn
 */
public class ProfessionalState extends State {

    public ProfessionalState(State state) {
        super.gamer = state.gamer;
        gamer.clearFuncs();
        gamer.addFunc(PRI);
        gamer.addFunc(SEC);
        gamer.addFunc(PRO);
    }

    @Override
    public void increasePoint(int point) {
        gamer.setPoint(gamer.getPoint() + point);
        stateCheck();
    }

    private void stateCheck() {
        if (gamer.getPoint() <= 40) {
            gamer.setActorState(new PrimaryState(this));
        } else if (gamer.getPoint() > 40 && gamer.getPoint() <= 80) {
            gamer.setActorState(new SecondaryState(this));
        } else if (gamer.getPoint() > 120) {
            gamer.setActorState(new FinalState(this));
        }
    }
}
